<?php
require_once("conf/db_connection.php");

$truck_id = $_GET['id'];
$stat = $_GET['stat'];

$new_stat = "";
if($stat=="1")
{
	$new_stat = "0";
}
else if($stat=="0")
{
	$new_stat = "1";
}
else
{
	$new_stat = $stat;
}


$update_truck = "UPDATE truck SET is_available = '".$new_stat."',available_date_time='".date("Y-m-d H:i:s")."' WHERE id = '".$truck_id."'";
mysql_query($update_truck) or die("UPDATE TRUCK AVAILABILITY ".mysql_error());

echo $new_stat;
?>